from openai import OpenAI
from globle import configs as cfg

# for backward compatibility, you can still use `https://api.deepseek.com/v1` as `base_url`.
client = OpenAI(api_key=cfg.DEEPSEEK_API_KEY, base_url="https://api.deepseek.com")

response = client.chat.completions.create(
    model="deepseek-chat",  # 必填，模型名称
    messages=[  # 必填，包装提示词的列表，有3个角色，system, user, assistant
        {"role": "system", "content": "你是中立的ai"},  # 系统角色，用以全局设置模型行为
        {"role": "user", "content": "跟我介绍deepseek"},  # 用户角色，用以设置用户输入
    ],
    max_tokens=128,  # 返回的最大token数
    temperature=1,  # 温度, 取值0~2, 简单理解是温度越高随机性越强
    stream=False
)
# for chunk in response:
#     print(chunk.choices[0].delta.content)
print(response.choices[0].message.content)
# print(response.choices[0].message.content)
